#ifndef BIBLEEBOOKWIDGET_H
#define BIBLEEBOOKWIDGET_H

#include <QWidget>
#include <QNetworkRequest>
#include <QList>

#include <QGridLayout>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QTreeWidget>
#include <QLineEdit>
#include <QPushButton>
#include <QScrollArea>

#include "biblereadercore.h"
#include "biblereaderdownloader.h"

// BookStack APIs


class BibleEbookWidget : public QWidget
{
    Q_OBJECT
public:
    BibleEbookWidget(BibleReaderCore *brCore, QWidget *parent = nullptr);
    ~BibleEbookWidget();

private slots:
    void readBook(QString identify);
    void downloadBook(QString bookName, QString identify, QString bookUrl);
    void saveBook();

private:
    void saveReadHistory(QString identify, int pageNum);
    void saveBookmark(QString identify, int pageNum);

private:
    void createWidgets();

private:
    BibleReaderCore *bibleReaderCore;
    QString saveBookFilePath;
    QString ebookPath;

    // GUI
    QLineEdit *searchBookField;
    QPushButton *goSearchBtn;
    QTreeWidget *bookCategories;

    QScrollArea *bookListArea;
    QWidget *bookList;
};

#endif // BIBLEEBOOKWIDGET_H
